package org.congapps.employees.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Column;
import javax.persistence.NamedQuery;
import javax.persistence.Temporal;
import static javax.persistence.TemporalType.DATE;

@Entity
@Table(name="employees")
@NamedQuery(name = "findAllEmployees", query = "select e from Employee e")
public class Employee implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	
	private int empNo;
	private Date birthDate;
	private String firstName;
	private String lastName;
	private String gender;
	private Date hireDate;
	//private Set<DeptEmp> departments = new HashSet<DeptEmp>(0);
	private Set<Salary> salaries = new HashSet<Salary>(0);
	private Set<Title> titles = new HashSet<Title>(0);

	public Employee() {
	}

	public Employee(int empNo, Date birthDate, String firstName,
			String lastName, String gender, Date hireDate) {
		this.empNo = empNo;
		this.birthDate = birthDate;
		this.firstName = firstName;
		this.lastName = lastName;
		this.gender = gender;
		this.hireDate = hireDate;
	}

	public Employee(int empNo, Date birthDate, String firstName,
			String lastName, String gender, Date hireDate,
			Set<Salary> salaries, Set<Title> titles) {
		this.empNo = empNo;
		this.birthDate = birthDate;
		this.firstName = firstName;
		this.lastName = lastName;
		this.gender = gender;
		this.hireDate = hireDate;
		//this.departments = departments;
		this.salaries = salaries;
		this.titles = titles;
	}

	@Id
	@Column(name="emp_no")
	public int getEmpNo() {
		return this.empNo;
	}

	
	public void setEmpNo(int empNo) {
		this.empNo = empNo;
	}

	@Column(name="birth_date")
	@Temporal(DATE)
	public Date getBirthDate() {
		return this.birthDate;
	}

	public void setBirthDate(Date birthDate) {
		this.birthDate = birthDate;
	}

	@Column(name="first_name")
	public String getFirstName() {
		return this.firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	@Column(name="last_name")
	public String getLastName() {
		return this.lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	@Column(name="gender")
	public String getGender() {
		return this.gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	@Column(name="hire_date")
	@Temporal(DATE)
	public Date getHireDate() {
		return this.hireDate;
	}

	public void setHireDate(Date hireDate) {
		this.hireDate = hireDate;
	}

/*	public Set<DeptEmp> getDepartments() {
		return this.departments;
	}

	@OneToOne(mappedBy="empNo")
	public void setDepartments(Set<DeptEmp> departments) {
		this.departments = departments;
	}*/

	public Set<Salary> getSalaries() {
		return this.salaries;
	}

	public void setSalaries(Set<Salary> salaries) {
		this.salaries = salaries;
	}


	public Set<Title> getTitles() {
		return this.titles;
	}

	public void setTitles(Set<Title> titles) {
		this.titles = titles;
	}

}
